import datetime
from applications.extensions import db


class Equipment(db.Model):
    __tablename__ = 'admin_equipment'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='id')
    Name = db.Column(db.String(20), comment='设备名称')
    Equid = db.Column(db.String(20), comment='设备编号')
    Version = db.Column(db.String(20), comment='设备版本')
    Equadmin = db.Column(db.String(20), comment='设备管理员')
    create_at = db.Column(db.DateTime, default=datetime.datetime.now, comment='添加时间')
    enable = db.Column(db.Integer, default=0, comment='启用')


class EquipmentCameras(db.Model):
    __tablename__ = 'equipments_cameras'
    table_id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='id')
    id = db.Column(db.String(40), comment='设备id')
    name = db.Column(db.String(40), comment='设备名称')
    x = db.Column(db.Integer)
    y = db.Column(db.Integer)
    z = db.Column(db.Integer)
    rx = db.Column(db.Integer)
    ry = db.Column(db.Integer)
    rz = db.Column(db.Integer)
    ip = db.Column(db.String(40), comment='设备ip')
    port = db.Column(db.Integer, comment='设备端口')
    channel = db.Column(db.Integer, comment='设备通道号')
    username = db.Column(db.String(40), comment='设备用户登录名')
    password = db.Column(db.String(40), comment='设备用户登录密码')
    rtsp = db.Column(db.String(40))
    map_id = db.Column(db.Integer)
    dept_id = db.Column(db.Integer, comment='设备所属部门id')
    dept_parent_name = db.Column(db.String(40), comment='')
    dept_name = db.Column(db.String(40), comment='')
